﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using XDesigner.ORM;
using 刘颜红销售项目管理.Business;
using 刘颜红销售项目管理.Business.DOM;

namespace 刘颜红销售项目管理
{
    public partial class frm工作日志 : DevExpress.XtraEditors.XtraForm
    {
        public frm工作日志()
        {
            InitializeComponent();
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            QueryConditionList conditions = new QueryConditionList();
            if (chkStartDate.Checked)
            {
                conditions.AddCondition("LogDateTime", ">=", dtpStart.Value.ToString("yyyyMMdd"));
            }
            if (chkEndDate.Checked)
            {
                conditions.AddCondition("LogDateTime", "<=", dtpEnd.Value.ToString("yyyyMMdd"));
            }
            ORMBindingSource bs = Business.MyApplicationFramework.Instance.ORMEngine.CreateBindingSource(
                typeof( Class工作日志 ) ,
                MyApplicationFramework.Instance.ORMEngine.ReadInstances(
                typeof( Class工作日志 ) , 
                conditions ));
            gd工作日志.DataSource = bs ;
        }

        private void chkStartDate_CheckedChanged(object sender, EventArgs e)
        {
            dtpStart.Enabled = chkStartDate.Checked;
        }

        private void chkEndDate_CheckedChanged(object sender, EventArgs e)
        {
            dtpEnd.Enabled = chkEndDate.Checked;
        }

        private void frm工作日志_Load(object sender, EventArgs e)
        {
            btnRefresh_Click(null, null);
        }
    }
}